
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import { Vector3 } from 'three';
import { cameraUtil } from './threeCameraUtil';
import { threeExport } from './threeExport';
import { rendererUtil } from './threeRenderUtil';
interface controlsUtil{
    controls: OrbitControls | undefined,
    controlsObjectPosition: Vector3,
    controlsTarget: Vector3,
}
export const controlsUtil =<controlsUtil> {
    controls: undefined,
    controlsObjectPosition: new THREE.Vector3(0,0,10),
    controlsTarget: new THREE.Vector3(0,0,0),
}
export function createControls() {
    if (!cameraUtil.camera || !rendererUtil.renderer) {
        console.error('Camera or renderer not initialized');
        return;
    }
    controlsUtil.controls = new OrbitControls(cameraUtil.camera, rendererUtil.renderer.domElement);
    controlsUtil.controls.enableDamping = true;
    controlsUtil.controls.object.position.copy(controlsUtil.controlsObjectPosition);
    controlsUtil.controls.target.copy(controlsUtil.controlsTarget);
}

